using System.Data.Entity.ModelConfiguration;
using SailHero.Soft.FrameWork.Models;

namespace SailHero.Soft.FrameWork.Mapping.UserDB
{
	public class UserInfoMap : EntityTypeConfiguration<UserInfo>
	{
		public UserInfoMap()
		{
			// Primary Key
			this.HasKey(t => t.UserId);

			// Properties
			this.Property(t => t.UserName)
				.IsRequired()
				.HasMaxLength(32);
				
			this.Property(t => t.Password)
				.IsRequired()
				.HasMaxLength(32);
				
			// Table & Column Mappings
			this.ToTable("UserInfo");
			this.Property(t => t.UserId).HasColumnName("UserId");
			this.Property(t => t.UserName).HasColumnName("UserName");
			this.Property(t => t.SafeMoney).HasColumnName("SafeMoney");
			this.Property(t => t.RegisterTime).HasColumnName("RegisterTime");
			this.Property(t => t.Password).HasColumnName("Password");
		}
	}
}

